import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/material.dart';
import '../../../app_files.dart';
import 'action.dart';
import 'state.dart';

Widget buildView(
    HotLineViewState state, Dispatch dispatch, ViewService viewService) {
  String contentStr =
      '尊敬的用户您好，${state.companyName}客户服务电话${state.consumerPhone}为您提供优质的服务。';

  return Scaffold(
    appBar: myAppBar(
      viewService.context,
      title: '客服电话',
      actions: [
        GestureDetector(
          behavior: HitTestBehavior.translucent,
          child: Container(
            padding: EdgeInsets.only(right: 12),
            height: 40,
            child: Center(
              child: Text(
                '拨打电话',
                style: TextThemeConfig.ActionBarTitle,
              ),
            ),
          ),
          onTap: () => CommonUtils.callPhone(
            state.consumerPhone,
            viewService.context,
          ),
        )
      ],
    ),
    backgroundColor: Colors.white,
    body: state.consumerPhone == null
        ? MyLoadingWidget()
        : Container(
            padding: EdgeInsets.only(top: 118),
            child: Column(
              children: [
                Image.asset('images/service_mobile.png'),
                Padding(
                  padding: EdgeInsets.only(top: 15, bottom: 5),
                  child: Text(
                    '客户服务电话',
                    style: TextThemeConfig.Font18WithBoldColor22,
                  ),
                ),
                Text(
                  state.consumerPhone,
                  style: TextThemeConfig.Font15WithColor22,
                ),
                Container(
                  margin: EdgeInsets.symmetric(horizontal: 50, vertical: 30),
                  child: Center(
                    child: Text(
                      contentStr,
                      style: TextThemeConfig.Font13WithColor66,
                    ),
                  ),
                ),
              ],
            ),
          ),
  );
}
